<template>
	<view class="wrap">
		<view class="header">
			<text class="one">我的积分:</text>
			<text class="two">99999</text>
		</view>
		<view class="content">
			<view class="u-tabs-box">
				<u-tabs-swiper activeColor="#cc0000" :bold="false" inactive-color="#666666" ref="tabs" :list="list"
					:current="current" @change="change" :is-scroll="false" swiperWidth="750" bg-color='#FFFFFF'>
				</u-tabs-swiper>
			</view>

			<swiper class="swiper-box" :current="swiperCurrent" @transition="transition"
				@animationfinish="animationfinish">
				<swiper-item>
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="page-box">
							<view class="item_left">
								<view class="goumai">购买商品</view>
								<view class="">
									<text>02-16</text>
									<text>16:00</text>
								</view>
							</view>
							<view class="item_rig">
								<text>+66</text>
							</view>
						</view>
					</scroll-view>
				</swiper-item>

				<swiper-item>
					<scroll-view scroll-y style="height: 100%;width: 100%;">
						<view class="page-box">
							<view class="item_left">
								<view class="">兑换商品</view>
								<view class="">
									<text>02-16</text>
									<text>16:00</text>
								</view>
							</view>
							<view class="item_rig">
								<text>-66</text>
							</view>
						</view>
					</scroll-view>
				</swiper-item>
			</swiper>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						name: '积分收入'
					},
					{
						name: '积分支出'
					}
				],
				current: 0,
				swiperCurrent: 0,
				tabsHeight: 0,
				dx: 0,
			}
		},
		methods: {
			// tab栏切换
			change(index) {
				this.swiperCurrent = index;
			},
			transition({
				detail: {
					dx
				}
			}) {
				this.$refs.tabs.setDx(dx);
			},
			animationfinish({
				detail: {
					current
				}
			}) {
				this.$refs.tabs.setFinishCurrent(current);
			}
		},
		// http配置请求
		onLoad(option) {
			//根据选项卡状态跳转对应下标
			this.current = option.type
			this.swiperCurrent = option.type
		}
	}
</script>

<style lang="scss" scoped>
	/* #ifndef H5 */
	page {
		width: 100%;
		height: 100%;
		background-color: #FFFFFF;
	}

	/* #endif */
	.header{
		height: 130rpx;
		padding: 25rpx;
		display: flex;
		align-items: center;
		.one{
			font-size: 30rpx;
			color: #4D4D4D;
		}
		.two{
			font-size: 40rpx;
			color: #d8ae00;
			margin-left: 10rpx;
		}
	}
	.u-tabs-box {
		border-top: 1px solid #E5E5E5;
		border-bottom: 1px solid #E5E5E5;
		background-color: #333;
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - var(--window-top));
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.page-box {
		/* height: 100%; */
		width: 90%;
		margin-left: 5%;
		margin-top: 15rpx;
		height: 134rpx;
		border-bottom: 1px solid #E5E5E5;
		border-top: 1px solid #E5E5E5;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.item_left{
			.goumai{
				font-size: 30rpx;
				color: #4D4D4D;
				margin-bottom: 20rpx;
			}
			text{
				font-size: 26rpx;
				color: #4c4c4c;
				margin-right: 20rpx;
			}
		}
		.item_rig{
			font-size: 30rpx;
			color: #E01212;
		}
	}
</style>
